//package com.aaa.tmr.util;
//
//import com.aaa.tmr.entity.Log;
//import com.aaa.tmr.entity.User;
//import com.aaa.tmr.service.LogService;
//import org.aspectj.lang.JoinPoint;
//import org.aspectj.lang.annotation.AfterReturning;
//import org.aspectj.lang.annotation.Aspect;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//import javax.servlet.http.HttpSession;
//import java.util.Date;
//
//@Component
//@Aspect
//public class LogUtil {
//    @Resource
//    private LogService logService;
//    @Resource
//    private HttpSession session;
//    @AfterReturning(pointcut = "execution(* com.aaa.tmr.controller.*.query*(..)) " +
//            "|| execution(* com.aaa.tmr.controller.*.to*(..))" +
//            "|| execution(* com.aaa.tmr.controller.*.sel*(..))" +
//            "|| execution(* com.aaa.tmr.controller.*.log*(..))")
//    public void  recordOperLog(JoinPoint joinPoint){
//        Log log =new Log();
//        User user = (User)session.getAttribute("userInfo");
//        if(user!=null){
//        log.setUserName(user.getUserName());
//        log.setLoginName(user.getLoginName());}
//        log.setIp("127.0.0.1");
//        //获取执行方法的名称
//        String methodName = joinPoint.getSignature().getName();
//        //带包的类名称 获取类的限定名
//        String className = joinPoint.getTarget().getClass().getName();
//        log.setMethodName(methodName);
//        log.setClassName(className);
//      //  log.setParams("[]");
//        Object[] args = joinPoint.getArgs();
//        if(args!=null&&args.length>0){
//            log.setParams(args[0].getClass().getSimpleName());
//        }
//        log.setCreateTime(new Date());
//        logService.insert(log);
//    }
//
//}
